﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
///ConvertObjectJson 的摘要说明
/// </summary>
public class ConvertObjectJson
{

    //将JSON类型字符串转化为对象
    public static T ParesJSONjss<T>(string str)
    {
        //str = str.Replace(",{}", "");
        System.Web.Script.Serialization.JavaScriptSerializer serlizer = new System.Web.Script.Serialization.JavaScriptSerializer();
        return serlizer.Deserialize<T>(str);
    }
    //将对象转为JSON字符串
    public static string RJsonTostr(object o)
    {
        System.Web.Script.Serialization.JavaScriptSerializer serlizer = new System.Web.Script.Serialization.JavaScriptSerializer();
        return serlizer.Serialize(o);
    }

}